package com.qiaofang.applet.common.dto;

/**
 * @Author: youqing.yang
 * @Create: 2020/10/19 11:02
 * @Description:
 **/
public class PageDTO {
    public static final Integer DEFAULT_PAGENUM = 1;
    public static final Integer DEFAULT_PAGESIZE = 20;
    public static final Integer MAX_PAGESIZE = 5000;
    public static final String DESC = "desc";
    public static final String ASC = "asc";
    private Integer pageSize;
    private Integer pageNum;
    private String sortBy;
    private String desc;

    public PageDTO() {
        this.pageSize = DEFAULT_PAGESIZE;
        this.pageNum = DEFAULT_PAGENUM;
    }

    public PageDTO(Integer pageNum, Integer pageSize) {
        this.pageSize = DEFAULT_PAGESIZE;
        this.pageNum = DEFAULT_PAGENUM;
        this.pageSize = pageSize;
        this.pageNum = pageNum;
    }

    public Integer getPageSize() {
        return this.pageSize;
    }

    public void setPageSize(Integer pageSize) {
        this.pageSize = pageSize;
    }

    public Integer getPageNum() {
        return this.pageNum;
    }

    public void setPageNum(Integer pageNum) {
        this.pageNum = pageNum;
    }

    public String getSortBy() {
        return this.sortBy;
    }

    public void setSortBy(String sortBy) {
        this.sortBy = sortBy;
    }

    public String getDesc() {
        return this.desc;
    }

    public void setDesc(String desc) {
        this.desc = desc;
    }

    public Integer getOffset() {
        Integer skipResults = (this.getPageNum() - 1) * this.getPageSize();
        return skipResults;
    }
}
